package com.atguigu.api

/**
 * @description: xxx
 * @time: 2020/6/19 22:46
 * @author: baojinlong
 **/
object ScalaDemo {
  def main(args: Array[String]): Unit = {
    val ch: Char = '1'
    val result: Int = ch match {
      case '+' => 1
      case '-' => -1
      case ch => Character.digit(ch, 10) + 3
      case _ => 0
    }
    println("ch=" + ch + " result= " + result)
    var result2 = 0
    val ch2 = '2'
    ch2 match {
      case '+' => result2 = 1
      case '-' => result2 = -1
      case ch2 => result2 = Character.digit(ch2, 10) + 3
    }

    println("ch2=" + ch2 + " result= " + result)
  }

}
